<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../vue 2.6.10.js"></script>
</head>

<body>
    <div id="app">
        <!-- 1.0 v-if -->
        <button @click="isLoad=true" >点击切换A</button>
        <button @click="isLoad=false" >点击切换B</button>
        <!-- 
        <button @click="type=1">点击切换A</button>
        <button @click="type=2">点击切换B</button>
        <button @click="type=3">点击切换C</button> -->
        <!-- <p v-if=isLoad>AAA</p>
        <p v-if=!isLoad>BBB</p> -->

        <!-- 2.0 v-else -->
        <!-- <p v-if=isLoad>AAA</p>
        <p v-else>BBB</p> -->

        <!-- 3.0 v-else-if -->
        <!-- <p v-if = "type===1">AAA</p>
        <p v-else-if = "type===2">BBB</p>
        <p v-else>CCC</p> -->

        <!-- 4.0 v-show
            全部渲染，只是用了display:none
        -->
            <p v-show="type===1">AAA</p>
            <p v-show="type===2">BBB</p>
            <p v-show="type===3">CCC</p>
    </div>
    <script>
        Vue.config.productionTip = false;

        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    isLoad: true,
                    type: 1
                }
            }
        })
    </script>
</body>

</html>